<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2018-09-29
 * Time: 13:48
 */

namespace backend\controllers;


use app\models\CrmHwzx;
use app\models\CrmHwzxHistoryDg;
use app\models\CrmHwzxHistoryGd;
use app\models\CrmHwzxHistoryGt;
use app\models\CrmHwzxHistoryKhfp;
use app\models\CrmHwzxZccl;
use app\models\search\CrmHwzxZcclSearch;
use yii\helpers\ArrayHelper;

class CrmHotCenterZcclController extends CommonController
{
    //查询 暂存处理
    public function actionList(){//查询
        $model = new CrmHwzxZcclSearch();
        $lists = $model->search(\Yii::$app->request->post());
        //分页
        $limit = is_set($_POST,"limit");
        $offset = is_set($_POST,"limit")*(is_set($_POST,"page")-1);
        $lists->query->limit($limit)->offset($offset);
        return $this->actionLayData($lists->count,$lists->query->asArray()->all(),0,'',is_set($_POST,"page"));
    }
    //删除 暂存处理
    public function actionDelete($id){
        $model = CrmHwzxZccl::findOne($id);
        if (!empty($model)){
            if ($model->delete()){
                return $this->dealFD("删除成功！");
            }else{
                return $this->dealFD("删除失败！",0);
            }
        }else{
            return $this->dealFD("删除失败！",0);
        }
    }

}